﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Kursovaya_Pav.St.Dm
{
    public partial class AccessUser : Form
    {
        
        
        public AccessUser()
        {
            
            InitializeComponent();
            
        }

       

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            
               
                Con_DB cdb = new Con_DB(@"DBdecor.accdb");

                
                    cdb.GetData("select * from Profile where login = '" + textBox1.Text + "' and Pass = '" + textBox2.Text + "'", dataSet1);
               
                
                if (dataSet1.Tables[0].Rows.Count > 0)
                {

                    this.DialogResult = DialogResult.OK;

                }
                dataSet1.Reset();
            
            
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
           
        }

        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                button1_Click(this, null);

        }
    }
}
